extends layout.pug

block styles
    link(rel='stylesheet', href='/noginx/static/switchery/dist/switchery.min.css')
    link(rel='stylesheet', href='/noginx/static/css/animate.min.css')
    link(rel='stylesheet', href='/noginx/static/select2/dist/css/select2.min.css')
    link(rel='stylesheet', href='/noginx/static/tippy.js/themes/light-border.css')
    link(rel='stylesheet', href='/noginx/static/css/index.css')

block content
    .main-content
        .col.btn-line
            a(href="/noginx/permissions/") 身份验证
            if (editable)
                button.btn.btn-info.mr-2#btn-new-permission 
                    i.iconfont.icon-add1
                    span  新增
                .btn.btn-info.btn-upload.mr-2
                    div
                        i.iconfont.icon-import2
                        span  导入
                    input.btn.btn-info.mr-2#btn-import(type="file", accept=".json")
            button.btn.btn-info.mr-2#btn-export
                i.iconfont.icon-export
                span  导出
        .table-responsive.mt-4.tb-wrap
            table.table
                thead
                    tr
                        th.th-auth 验证
                        th.th-domain 域名
                        th.text-left 匹配路由
                        th.th-excludes 排除项
                        if (editable)
                            th.th-action 操作
                tbody.results
                    each permission in permissionList
                        include ./partials/permission-tr.pug
                tfoot(style={display: permissionList.length === 0 ? 'table-row-group' : 'none'})
                    tr
                        td(colspan=5) 
                            p.no-data 无数据
    .modal.animated.bounceInDown#permission-modal(data-keyboard="false")
        .modal-dialog.modal-dialog-centered(role='document')
            .modal-content
                .modal-header
                    h5.modal-title 新增
                    button.close(type='button' data-dismiss='modal' aria-label='Close')
                        span(aria-hidden='true') &times;
                .modal-body
                    .form-group
                        label(for='') 验证方式
                        select.custom-select.form-control#select-auth
                            option(value="") --请选择--
                            each rule in pms
                                option(value=rule.file)=rule.title
                    .form-group
                        label(for='') 请求方式
                        select.custom-select.form-control#select-method
                            option(value="") --不限--
                            each method in methods
                                option(value=method)=method
                    .form-group
                        label(for='') 匹配域名
                        .input-group
                            select.custom-select.form-control#select-domain
                                option(value="") --不限--
                                each domain in domainList
                                    option(value=domain.id)=domain.domainPath
                            .input-group-append
                                span.my-input-group-text.my-input-group-text2
                                    a(href="/noginx/domains/")
                                        i.iconfont.icon-global(title="配置域名")
                    .form-group
                        label(for='input-uri') 匹配路径
                        .input-group#group-uri
                            .input-group-prepend
                                select.custom-select.form-control.prepend-select#select-type
                                    option(value='start') 开头
                                    option(value='exact') 精确
                                    option(value='regexp') 正则
                            input.form-control#input-uri(placeholder="匹配开头", spellcheck="false")
                    .form-group
                        label(for='input-params') 
                            span 匹配参数
                        i.tip(data-tippy-content="示例：query.from === 'home' && cookies.H5_CITY <br>内置对象：query: 查询字符串，body: 请求体，cookies: 客户端Cookie") i
                        input.form-control#input-params(placeholder="返回布尔类型的表达式", spellcheck="false")
                    .form-group#exclude-container
                        label(for='') 排除项
                        button.btn.btn-sm.btn-info.float-right.btn-new-exc#btn-new-exclude(type="button", title="添加") 
                            i.iconfont.icon-add
                .modal-footer
                    a.btn.btn-link.btn-howto.text-info(href="/noginx/help/#如何设置登录后才能访问？", target="_blank") 如何配置？
                    button.btn.btn-default(type='button' data-dismiss='modal') 取消
                    button.btn.btn-info#btn-save(type='button') 保存修改
    .modal.animated.bounceInDown#excludes-modal(data-keyboard="false")
        .modal-dialog.modal-dialog-centered(role='document')
            .modal-content
                .modal-header
                    h5.modal-title 排除项
                    button.close(type='button' data-dismiss='modal' aria-label='Close')
                        span(aria-hidden='true') &times;
                .modal-body.exclude-body
                .modal-footer
                    button.btn.btn-info(type='button' data-dismiss='modal') 关闭
    input#uid(type="hidden")
    input#editable(type="hidden", value=editable.toString())
    script(src='/noginx/static/jquery/dist/jquery.min.js')
    script(src='/noginx/static/popper.js/dist/umd/popper.min.js')
    script(src='/noginx/static/bootstrap/dist/js/bootstrap.min.js')
    script(src='/noginx/static/js/search.js')
    script(src='/noginx/static/sweetalert/dist/sweetalert.min.js')
    script(src='/noginx/static/tippy.js/umd/index.all.min.js')
    script(src='/noginx/static/select2/dist/js/select2.js')
    script(src='/noginx/static/js/permissions.js')
